package org.obm.mina;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class FileUtil {
	
    /**
     * Returns <tt>true</tt> if the given file is gzipped.
     */
    public static boolean isGzipped(File file) throws IOException {
        InputStream in = null;
        try {
            FileInputStream fin = new FileInputStream(file);
            in = new BufferedInputStream(fin, 2);
            return ByteUtil.isGzipped(in);
        } finally {
            ByteUtil.closeStream(in);
        }
    }
}
